/*==============================================================*/
/* DBMS name:      Microsoft SQL Server 2005                    */
/* Created on:     2009-8-2 13:46:25                            */
/*==============================================================*/


if exists (select 1
            from  sysobjects
           where  id = object_id('"rel_user_ decorate"')
            and   type = 'U')
   drop table "rel_user_ decorate"
go

if exists (select 1
            from  sysobjects
           where  id = object_id('rel_user_goods')
            and   type = 'U')
   drop table rel_user_goods
go

if exists (select 1
            from  sysobjects
           where  id = object_id('rel_user_house')
            and   type = 'U')
   drop table rel_user_house
go

if exists (select 1
            from  sysobjects
           where  id = object_id('rel_user_scene')
            and   type = 'U')
   drop table rel_user_scene
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_decorate')
            and   type = 'U')
   drop table tb_decorate
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_goods')
            and   type = 'U')
   drop table tb_goods
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_house')
            and   type = 'U')
   drop table tb_house
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_next_id')
            and   type = 'U')
   drop table tb_next_id
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_rpc')
            and   type = 'U')
   drop table tb_rpc
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_scene')
            and   type = 'U')
   drop table tb_scene
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_shop')
            and   type = 'U')
   drop table tb_shop
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_user')
            and   type = 'U')
   drop table tb_user
go

if exists (select 1
            from  sysobjects
           where  id = object_id('tb_user_shop_info')
            and   type = 'U')
   drop table tb_user_shop_info
go

/*==============================================================*/
/* Table: "rel_user_ decorate"                                  */
/*==============================================================*/
create table "rel_user_decorate" (
   user_id              numeric(22)          not null,
   "decorate_id"       numeric(22)          not null,
   total_amount         numeric(22)          null,
   avalid_amount        numeric(22)          null,
   constraint "PK_REL_USER_DECORATE" primary key (user_id, "decorate_id")
)
go

/*==============================================================*/
/* Table: rel_user_goods                                        */
/*==============================================================*/
create table rel_user_goods (
   user_id              numeric(22)          not null,
   goods_id             numeric(22)          not null,
   amount               numeric(22)          null,
   constraint PK_REL_USER_GOODS primary key (user_id, goods_id)
)
go

/*==============================================================*/
/* Table: rel_user_house                                        */
/*==============================================================*/
create table rel_user_house (
   user_id              numeric(22)          not null,
   house_id             numeric(22)          not null,
   total_amount         numeric(22)          null,
   avalid_amount        numeric(22)          null,
   constraint PK_REL_USER_HOUSE primary key (user_id, house_id)
)
go

/*==============================================================*/
/* Table: rel_user_scene                                        */
/*==============================================================*/
create table rel_user_scene (
   user_id              numeric(22)          not null,
   scene_id             numeric(22)          not null,
   total_amount         numeric(22)          null,
   avalid_amount        numeric(22)          null,
   constraint PK_REL_USER_SCENE primary key (user_id, scene_id)
)
go

/*==============================================================*/
/* Table: tb_decorate                                           */
/*==============================================================*/
create table tb_decorate (
   decorate_id          numeric(22)          not null,
   name                 nvarchar(128)        null,
   description          nvarchar(512)        null,
   price                numeric(18,2)        null,
   "src_ swf"           nvarchar(512)        null,
   shop_class           smallint             null,
   decorate_class       smallint             null,
   constraint PK_TB_DECORATE primary key (decorate_id)
)
go

/*==============================================================*/
/* Table: tb_goods                                              */
/*==============================================================*/
create table tb_goods (
   goods_id             numeric(22)          not null,
   name                 nvarchar(128)        null,
   description          nvarchar(512)        null,
   price                numeric(18,2)        null,
   "src_ swf"           nvarchar(512)        null,
   goods_class          smallint             null,
   sub_class            smallint             null,
   constraint PK_TB_GOODS primary key (goods_id)
)
go

/*==============================================================*/
/* Table: tb_house                                              */
/*==============================================================*/
create table tb_house (
   house_id             numeric(22)          not null,
   name                 nvarchar(128)        null,
   description          nvarchar(512)        null,
   price                numeric(18,2)        null,
   "src_ swf"           nvarchar(512)        null,
   shop_class           smallint             null,
   constraint PK_TB_HOUSE primary key (house_id)
)
go

/*==============================================================*/
/* Table: tb_next_id                                            */
/*==============================================================*/
create table tb_next_id (
   obj_name             varchar(128)         null,
   next_id              numeric(22)          null
)
go

/*==============================================================*/
/* Table: tb_rpc                                                */
/*==============================================================*/
create table tb_rpc (
   rpc_id               numeric(22)          not null,
   name                 nvarchar(128)        null,
   src_scene            nvarchar(512)        null,
   constraint PK_TB_RPC primary key (rpc_id)
)
go

/*==============================================================*/
/* Table: tb_scene                                              */
/*==============================================================*/
create table tb_scene (
   scene_id             numeric(22)          not null,
   name                 nvarchar(128)        null,
   description          nvarchar(512)        null,
   price                numeric(18,2)        null,
   src_swf              nvarchar(512)        null,
   constraint PK_TB_SCENE primary key (scene_id)
)
go

/*==============================================================*/
/* Table: tb_shop                                               */
/*==============================================================*/
create table tb_shop (
   shop_id              numeric(22)          not null,
   name                 nvarchar(128)        null,
   description          nvarchar(512)        null,
   user_id              numeric(22)          null,
   scene_id             numeric(22)          null,
   house_id             numeric(22)          null,
   constraint PK_TB_SHOP primary key (shop_id)
)
go

/*==============================================================*/
/* Table: tb_user                                               */
/*==============================================================*/
create table tb_user (
   user_id              numeric(22)          not null,
   name                 nvarchar(128)        null,
   email                nvarchar(128)        null,
   login_name           nvarchar(128)        null,
   password             nvarchar(128)        null,
   sex                  smallint             null,
   constraint PK_TB_USER primary key (user_id)
)
go

/*==============================================================*/
/* Table: tb_user_shop_info                                     */
/*==============================================================*/
create table tb_user_shop_info (
   info_id              numeric(22)          not null,
   score                numeric(18,2)        null,
   game_coin            numeric(18,2)        null,
   deposit              numeric(18,2)        null,
   level                smallint             null,
   constraint PK_TB_USER_SHOP_INFO primary key (info_id)
)
go

